﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>从表导入</title>
    <link href="../../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Comm/Gener.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script src="../../CCFlowEnum.js" type="text/javascript"></script>
    <script type="text/javascript">

        $(function () {

            InitBar("Main");

            //查询出来数据.
            var frmID = GetQueryString("FK_MapData");
            var refPK = GetQueryString("RefPK");

            var thisPK = refPK + "_FullData";

            var en = new Entity("BP.Sys.MapExt");
            en.MyPK = refPK + "_FullData";
            en.SetPKVal(thisPK);
            en.RetrieveFromDBSources();

            //给下列框赋值.
            GenerFullAllCtrlsVal(en);

        });

        function Save() {

            //更新节点表单类型.
            var frmID = GetQueryString("FK_MapData");
            var refPK = GetQueryString("RefPK");

            var thisPK = refPK + "_FullData";

            var en = new Entity("BP.Sys.MapExt");
            en.MyPK = refPK + "_FullData";
            en.SetPKVal(en.MyPK);
            var i = en.RetrieveFromDBSources();

            //            en.MyPK = refPK + "_FullData";
            //            en.SetPKVal(refPK + "_FullData");

            en.FK_MapData = frmID;
            en.ExtType = "FullData";
            en.DBType = $("#DDL_DBType").val(); //获得选择的值.

            var sql = $("#TB_Doc").val();
            en.Doc = sql; //设置主表的SQL.
            var tag2 = $("#TB_Tag2").val();
            en.Tag2 = tag2; //设置主表的SQL.

            if (i == 0)
                en.Insert();
            else
                en.Update();

            window.location.href = window.location.href;
        }
    </script>
</head>
<body>
    <form id="cc">
    <div id="bar">
    </div>
    <table style="width: 99%;">
        <tr>
            <th colspan="2">
                填充主表数据SQL
            </th>
        </tr>
        <tr>
            <td colspan="2">
                <textarea rows="4" name="TB_Doc" id="TB_Doc" style="width: 99%;"> </textarea>
            </td>
        </tr>
        <tr>
            <td>
                数据源类型
            </td>
            <td>
                <select id="DDL_DBType" name="DDL_DBType">
                    <option value="0">执行SQL</option>
                    <option value="1">执行url返回JSON</option>
                    <option value="2">执行CCFromRef.js返回JSON</option>
                </select>
            </td>
        </tr>
        <tr>
            <th colspan="4">
                <a href="javascript:ShowHidden('backFunction')">确定后执行的JS</a>
                <div id="backFunction" style="color: Gray; display: none">
                    <ul>
                        <li>该选项可以为空,弹出框确定后执行的JS，可以直接写方法名或者方法().</li>
                    </ul>
                </div>
            </th>
        </tr>
        <tr>
            <td colspan="4">
                <input id="TB_Tag2" name="TB_Tag2" style="width: 100%;" />
            </td>
        </tr>
    </table>
    <fieldset>
        <legend>帮助.</legend>
        <ul>
            <li>填充主表的SQL, </li>
            <li>必须返回一行数据.</li>
        </ul>
    </fieldset>
    </form>
</body>
</html>
